﻿namespace Sidvall.LogManager.Configuration
{
    public static partial class SettingsManager
    {
        #region Public Members

        #region STSBaseAddressResolved

        public static string STSBaseAddressResolved
        {
            get
            {
                var value = Sidvall.LogManager.SystemContext.Current.UserConfiguration?.STSAddress;
                if (!string.IsNullOrWhiteSpace(value))
                    return value;
                return STSBaseAddress;
            }
        }

        #endregion
        #region STSClientIdResolved

        public static string STSClientIdResolved
        {
            get
            {
                var value = Sidvall.LogManager.SystemContext.Current.UserConfiguration?.STSClientId;
                if (!string.IsNullOrWhiteSpace(value))
                    return value;
                return STSClientId;
            }
        }

        #endregion
        #region STSClientSecretResolved

        public static string STSClientSecretResolved
        {
            get
            {
                var value = Sidvall.LogManager.SystemContext.Current.UserConfiguration?.STSClientSecret;
                if (!string.IsNullOrWhiteSpace(value))
                    return value;
                return STSClientSecret;
            }
        }

        #endregion
        #region TwoFactorProviderResolved

        public static Sidvall.Security.TwoFactorProvider TwoFactorProviderResolved
        {
            get
            {
                var value = Sidvall.LogManager.SystemContext.Current.UserConfiguration?.TwoFactorProvider;
                if (value != null)
                    return value.Value;
                return TwoFactorProvider;
            }
        }

        #endregion

        #endregion
    }
}
